import Vue from "vue"
import VueRouter from "vue-router"
import Layout from "@components/Layout"
import AppView from "@components/View/index"
import Error404 from "@components/Error/404.vue"

Vue.use(VueRouter)
export const operationPage = [
  {
    path: "/home",
    name: "Home",
    component: () => import("@views/home/index.vue"),
    meta: { title: "首页", hideHeader: true }
  },
  {
    path: "/search",
    name: "Search",
    redirect: "/search/index",
    component: AppView,
    children: [
      {
        path: "index",
        name: "SearchIndex",
        
        component: () => import("@views/search/index.vue"),
        meta: { title: "查询", keepAlive: true, }
      },
      {
        path: "delay",
        name: "SearchDelay",
        component: () => import("@views/search/delay.vue"),
        meta: { title: "延期" }
      },
      {
        path: "progress",
        name: "SearchProgress",
        component: () => import("@views/search/progress.vue"),
        meta: { title: "审批进度" }
      },
      {
        path: "adjustRoute",
        name: "SearchAdjustRoute",
        component: () => import("@views/search/adjustRoute.vue"),
        meta: { title: "调整路线" }
      },
      {
        path: "vehicleChange",
        name: "SearchVehicleChange",
        component: () => import("@views/search/vehicleChange.vue"),
        meta: { title: "车辆变更" }
      },
    ]
  },
  {
    path: "/apply",
    name: "Apply",
    redirect: "apply/cargo",
    component: () => import("@views/apply/index.vue"),
    children: [
      {
        path: "cargo",
        name: "ApplyCargo",
        component: () => import("@views/apply/cargo.vue"),
        meta: { title: "货物信息", keepAlive: true }
      },
      {
        path: "vehicleList",
        name: "ApplyVehicleList",
        component: () => import("@views/apply/vehicleList.vue"),
        meta: { title: "车辆信息", keepAlive: true }
      },
      {
        path: "overAll",
        name: "ApplyOverAll",
        component: () => import("@views/apply/overAll.vue"),
        meta: { title: "车货总体信息", keepAlive: true }
      },
      {
        path: "generalInfo",
        name: "ApplyGeneralInfo",
        component: () => import("@views/apply/generalInfo.vue"),
        meta: { title: "通行信息", keepAlive: true }
      },
      {
        path: "agent",
        name: "ApplyAgent",
        component: () => import("@views/apply/agent.vue"),
        meta: { title: "经办人信息", keepAlive: true }
      },
      {
        path: "other",
        name: "ApplyOther",
        component: () => import("@views/apply/other.vue"),
        meta: { title: "其他材料", keepAlive: true }
      }
    ],
  },
  {
    path: "/notice",
    name: "notice",
    component: () => import("@views/notice/index.vue"),
    meta: { title: "跨省超限运输许可须知" }
  }
];

export const registerPage = [
  {
    path: "/register",
    name: "Register",
    component: () => import("@views/register/index.vue"),
    meta: { title: "补充材料", hideHeader: true }
  },
];
export const waitPage = [
  {
    path: "/wait",
    name: "Wait",
    component: () => import("@views/register/wait.vue"),
    meta: { title: "审核结果", hideHeader: true }
  }
]

export const notFound = { path: "*", redirect: "/404", hidden: true }
export const routes = [
  {
    path: "/404",
    name: "404",
    component: Error404
  },
  {
    path: "/",
    name: "root",
    // redirect:'/register',
    component: Layout,
    // children: operationPage
    /* children: [
      {
        path: "register",
        redirect: "/register/index",
        name: "Register",
        component: AppView,
        // meta: { title: '补充材料', hideHeader: true },
        children: [
          {
            path: "index",
            name: "RegisterIndex",
            component: () => import("@views/register/index.vue"),
            meta: { title: "补充材料", hideHeader: true }
          },
          {
            path: "wait",
            name: "RegisterWait",
            component: () => import("@views/register/wait.vue"),
            meta: { title: "审核结果", hideHeader: true }
          }
        ]
      }, */
      // ...operationPage
    // ]
  }
]

const router = new VueRouter({
  routes
})

export default router
